/*
 * Queue.h
 *
 *  Created on: 2011-5-22
 *      Author: william nie
 */

#include<stdio.h>
#include<stdlib.h>
#include "datadef.h"

#ifndef QUEUE_H_
#define QUEUE_H_

typedef int QElemType;
typedef struct QNode{
	QElemType* data;
	struct QNode* next;
} QNode;

typedef struct {
	QNode* front;
	QNode* rear;
	int length;
	int size;
} Queue;

typedef BOOL (*QueueVisit)(QNode *qNode);

Status InitQueue(Queue **queue);

Status DestroyQueue(Queue **queue);

Status ClearQueue(Queue *queue);

BOOL QueueEmpty(Queue *queue);

int QueueLength(Queue *queue);

QNode* GetHead(Queue *queue);

Status EnQueue(Queue *queue , QElemType *node);

QElemType* DeQueue(Queue *queue);

Status QueueTraverse(Queue *queue, QueueVisit visit);

/*****Nonstandard Functions*****/

BOOL DefaultQueueVisit(QNode *qNode);

Status FillQueue(Queue *queue);

#endif /* QUEUE_H_ */
